package com.walter.learn.TestUtil;

import com.walter.learn.computingTextSimilarity.CosineSimilarity;
import com.walter.learn.computingTextSimilarity.JaccardSimilarity;
import org.junit.Test;

/**
 * @ProjectName: learn
 * @Package: com.walter.learn.TestUtil
 * @ClassName: SimilarityTest
 * @Author: DELL
 * @Description: 测试余弦相似度算法
 * @Date: 2019/8/26 15:32
 * @Version: 1.0
 */
public class SimilarityTest {
    @Test
    public void testCosineGetSimilarity(){
        String s1 = "我是一个帅哥";
        String s2 = "帅哥是我";
        CosineSimilarity similarity = new CosineSimilarity(s1, s2);
        System.out.println(similarity.getSimilarity());
    }

    @Test
    public void testJaccardGetSimilarity(){
        String s1="我是一个大帅哥";
        String s2="帅哥是我";
        float similarity = JaccardSimilarity.getSimilarity(s1, s2);
        System.out.println(similarity);
    }
}
